import { regCategoryList, regcontainList, regfloorList } from "@/api";
export default {
    namespaced: true,
    actions: {
        //向服务器发生请求
        async categoryList({ commit }) {
            let result = await regCategoryList()
            if (result.code == 200) {
                commit("CATEGORYLIST", result.data)
            }
        },
        async containlist({ commit }) {
            let result = await regcontainList()
            // console.log(result)
            if (result.code == 200) {
                commit("CONTAINLIST", result.data)
            }
        },
        async getfloorlist({ commit }) {
            let result = await regfloorList()
            if (result.code == 200) {
                commit("GETFLOOTLIST", result.data)
            }
        }
    },
    mutations: {
        //在state存入服务器数据
        CATEGORYLIST(state, result) {
            state.categoryLists = result
            // console.log(state.categoryLists)
        },
        CONTAINLIST(state, value) {
            state.containlists = value
        },
        GETFLOOTLIST(state, value) {
            state.floorlists = value
            // console.log(value)
        }

    },
    state: {
        categoryLists: [],
        containlists: [],
        floorlists: [],

    },
    getters: {},
}